package com.lex.notepad;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

/**
 * Created by Administrator on 2016/6/29.
 */
public class MyDataBaseHelper extends SQLiteOpenHelper{

    public static final String NOTEPAD = "create table notepad("
            + "id integer primary key autoincrement,"
            + "user_name string,"
            + "pass_word string,"
            + "title string,"
            + "context string)";

    private Context mContext;

    public MyDataBaseHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        mContext = context;
    }


    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(NOTEPAD);
        Toast.makeText(mContext,"注册成功",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

    }
}
